package com.neuedu.controller;

import com.neuedu.entity.Nurselevel;
import com.neuedu.service.NurselevelService;
import com.neuedu.vo.ResultJson;
import jakarta.annotation.Resource;
import lombok.Getter;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 护理级别 前端控制器
 * </p>
 *
 * @author wangyu
 * @since 2025-10-22
 */
@RestController
@RequestMapping("/nurselevel")
public class NurselevelController {
    @Resource
    NurselevelService nurselevelService;
    @GetMapping("/list")
    ResultJson<List<Nurselevel>> list (Integer status) {
        return ResultJson.success(nurselevelService.list(status));
    }
    @GetMapping("/getById")
    ResultJson<Nurselevel> getById (Integer id) {
        return ResultJson.success(nurselevelService.getById(id));
    }
    @PostMapping("/add")
    ResultJson<Boolean> add (Nurselevel nurselevel) {
        return ResultJson.success(nurselevelService.add(nurselevel), "添加护理成功");
    }
    @PostMapping("/update")
    ResultJson<Boolean> update(Nurselevel nurselevel) {
        return ResultJson.success(nurselevelService.update(nurselevel), "修改护理成功");
    }
    @PostMapping("/delete")
    ResultJson<Boolean> del(Integer id) {
        return ResultJson.success(nurselevelService.del(id), "删除护理成功");
    }
    @GetMapping("/check")
    ResultJson<Boolean> check(String field, String value, Integer id) {
        return ResultJson.success(nurselevelService.check(field, value, id));
    }
}
